#import "UIViewController+LCTrack.h"
#import "NSObject+LCSwizzle.h"
#import "LCAutoTrackManager.h"

@implementation UIViewController (LCTrack)

+ (void)lc_swizzleViewDidAppear {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        [self lc_swizzleInstanceMethod:@selector(viewDidAppear:) with:@selector(lc_viewDidAppear:)];
    });
}

- (void)lc_viewDidAppear:(BOOL)animated {
    [self lc_viewDidAppear:animated];

    NSString *pageName = NSStringFromClass([self class]);
    [LCAutoTrackManager trackEventWithName:@"page_view" params:@{@"page": pageName}];
}

@end